<?php

namespace App\Admin\Controllers;

use App\Models\CourseEvaluate;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;

class CourseEvaluateController extends AdminController
{
    /**
     * Title for current resource.
     *
     * @var string
     */
    protected $title = '课程评价';

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = new Grid(new CourseEvaluate());
        $grid->disableActions();
        $grid->disableCreateButton();
        $grid->disableRowSelector();

        $grid->column('id', 'ID');
        $grid->column('course.name', '课程');
        $grid->column('user.name', '用户');
        $grid->column('star', '评价等级')->display(function ($star) {
            return $star . '星';
        });
        $grid->column('content', '内容');
        $grid->column('created_at', '创建时间');

        return $grid;
    }


}
